You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raw-body was used in a way that it only converted the request to a Buffer. This PR replaces usage of raw-body with a less complex, native approach, removing not just the 11 dependencies that came with raw-body, but also undici's only subdependency (that was gone after updating undici). As such this PR lowers the amount of transitive dependencies in this package from 13 down to one (1).
I've tested that this approach and the way raw-body was used both give the same output, making this a free ~40% decrease in total bundle size
Would love to turn the SDK into a zero-dependency library, although we'd need a few more tests to ensure this would work across most HTTP clients such as express, hono, etc.
turning this into a zero dep library shouldn't be hard after this pr, i believe undici can be removed considering node versions below 18 are not supported oh undici was already removed :^)
raw-body does a lot more than just retrieve the body though, it also checks the body length and handles things like stream abortions.
is there a default length limit raw-body uses? as far as i'm aware the limit option which configures this is not in use. regarding aborting the stream, i can add some extra logic for handling that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
raw-bodywas used in a way that it only converted the request to a Buffer. This PR replaces usage ofraw-bodywith a less complex, native approach, removing not just the 11 dependencies that came withraw-body, but alsoundici's only subdependency (that was gone after updatingundici). As such this PR lowers the amount of transitive dependencies in this package from 13 down to one (1).I've tested that this approach and the way
raw-bodywas used both give the same output, making this a free ~40% decrease in total bundle sizeCode I ran to test
https://runkit.com/embed/4hcq12gepy26